home *** CD-ROM | disk | FTP | other *** search
/ World of Education / World of Education.iso / world_s / startrek.zip / CHAPTER.006 < prev    next >
Text File  |  1989-05-15  |  50KB  |  991 lines

  1.         Chapter6 PAGE 1 STARTREK THE COMPUTER PROGRAM
  2.  
  3.  
  4.                                     CHAPTER 6
  5.  
  6.         6.1  Short Range Sensors
  7.  
  8.              The Short Range Sensors are the means by which a short range 
  9.         radar scan is performed.  They let the player examine  everything 
  10.         that   is  in  the  Quadrant  as  well  providing   game   status 
  11.         information. 
  12.  
  13.              There are 64 sectors in the quadrant which is also organized 
  14.         as 8 rows of 8 sectors.  In order for the computer to access each 
  15.         sector some technique must be employed to store the quadrant  and 
  16.         the contents of the sectors into the computer.
  17.  
  18.              We have already discussed that the contents of the  quadrant 
  19.         are  stored in an array variable Q(I,J) as an array of  rows  and 
  20.         columns  where  I  represents  the row and  J  the  column.   The 
  21.         Quadrant  array can thus be considered as having  two  dimensions 
  22.         and  the  contents of any quadrant can be  defined  using  Q(I,J) 
  23.         where I and J define the row and column co-ordinates respectively 
  24.         (ie. Q(2,6) refers to the contents of a quadrant that is two rows 
  25.         down from the top corner and 6 columns along the row).
  26.  
  27.              Each  quadrant itself contains 64 sectors, also arranged  as 
  28.         an  8  by 8 array.  The ground rules of the game only  allow  one 
  29.         object  to be in a sector at any one time.   The contents of  the 
  30.         sectors  are  kept track of in an array similar to  the  quadrant 
  31.         array Q, but this time called S(I,J).  For example, S(2,6) refers 
  32.         to  the actual sector, the contents of the location in the  array 
  33.         define  what is in the sector.  The contents can be set by  using 
  34.         the LET statement such as
  35.                                  LET S(2,6) = 1.  
  36.              The  contents  of  any  sector  can  be  assigned  a  number 
  37.         corresponding to the occupant as follows, 
  38.  
  39.         1    represents a blank or empty sector
  40.         2    represents a star
  41.         3    represents the Enterprise
  42.         4    represents a Klingon (an enemy vessel)
  43.         5    represents a starbase
  44.  
  45.              An example of a Short Range Sensor scan is shown below.
  46.  
  47.         SHORT RANGE SENSORS IN QUADRANT 4,6
  48.  
  49.            1 2 3 4 5 6 7 8   SCORE               511.3
  50.          1 . . . . . . . .   TIME LEFT           23.9
  51.          2 * . . . . . . .   CONDITION           RED
  52.          3 . . . K . . . K   SHIELDS             255.6
  53.          4 . . . . . . . .   ENERGY              3456.0
  54.          5 . . . . * . . .   PHOTON TORPEDOES    3
  55.          6 . . . * * . * .   STARBASES           2
  56.          7 . . . . . E . .   KLINGONS LEFT       21
  57.          8 . . . . . * . .   KLINGONS CAPTURED   0
  58.  
  59.  
  60.  
  61.         Copyright (c) Joe Kasser 1989
  62.  
  63.  
  64.  
  65.  
  66.  
  67.         Chapter6 PAGE 2 STARTREK THE COMPUTER PROGRAM
  68.  
  69.  
  70.              The occupants of the sector in the basic game can be any one 
  71.         of the following, 
  72.  
  73.          .    represents a blank or empty sector
  74.          *    represents a star
  75.          E    represents the Enterprise
  76.          K    represents a Klingon (an enemy vessel)
  77.          B    represents a starbase 
  78.  
  79.              The  game status information alongside the radar display  is 
  80.         as follows;
  81.  
  82.         TIME LEFT     The amount of play time left in the game.
  83.  
  84.         CONDITION     The  state  of  the Enterprise.   There  are  three 
  85.                       possible conditions,
  86.              
  87.                       RED Battle area, enemy in quadrant
  88.  
  89.                       YELLOW      One  of  the  sub-systems  aboard   the 
  90.                       Enterprise  is  damaged, or the  Energy  level  has 
  91.                       fallen to below 400 units.
  92.  
  93.                       GREEN  Everything  is fine, no enemy  detected,  no 
  94.                       damage, and sufficient available energy aboard  the 
  95.                       ship.
  96.  
  97.         SHIELDS       The  amount  of  energy  allocated  to  the  ship's 
  98.                       shields.  If this energy level is ever beaten  down 
  99.                       to  zero by the enemy, the Enterprise is  destroyed 
  100.                       and you lose the game.
  101.  
  102.         ENERGY        The  amount of energy on board the Enterprise.   If 
  103.                       this  ever falls to zero, the Enterprise becomes  a 
  104.                       derelict in space, and you lose the game.
  105.  
  106.         PHOTON TORPEDOES     The number of photon torpedoes remaining  on 
  107.                       board the Enterprise.
  108.  
  109.         STARBASES     The  number of starbase in the galaxy, even if  you 
  110.                       have not located them all.
  111.  
  112.         KLINGONS LEFT     The  number  of  enemy  ships  in  the  galaxy.  
  113.                       Should you destroy them all, you will win the game.
  114.  
  115.         KLINGONS CAPTURED      The  number  of  enemy  vessels  you  have 
  116.                       captured.  Each one captured is a bonus  multiplier 
  117.                       on your score.
  118.  
  119.              The  flow chart for the Short Range Sensor routine is  shown 
  120.         in figure 6.1.
  121.  
  122.                   In order to perform a short range sensor scan, we first 
  123.         have to test if the short range scanners are damaged. If they are 
  124.         damaged, the contents of the quadrant cannot be scanned let alone 
  125.  
  126.  
  127.         Copyright (c) Joe Kasser 1989
  128.  
  129.  
  130.  
  131.  
  132.  
  133.         Chapter6 PAGE 3 STARTREK THE COMPUTER PROGRAM
  134.  
  135.  
  136.         displayed.  Thus a message that tells the player that the sensors 
  137.         are broken is displayed.  
  138.  
  139.              Assuming workable sensors, a test is performed to  determine 
  140.         if  the  Enterprise  is inside the galaxy. If it  is  inside  the 
  141.         galaxy,  and if the computer is up, the quadrant data  is  loaded 
  142.         into the Map.  If the computer is down, the scan will take place, 
  143.         the  information  will be displayed on the screen, but  the  data 
  144.         will  not be put into the map.  The display heading is  generated 
  145.         and the column numbers and score displayed.
  146.  
  147.              The display routine comprises a similar pair of loops to the 
  148.         map  routine.   Here the contents of the sector are  shown  as  a 
  149.         letter, followed by a "space" character.  At the end of each row, 
  150.         one item of game status information is displayed.  The cursor  is 
  151.         then moved to the start of the next line, and the loops continue.
  152.  
  153.              The BASIC language implementation of the flowchart can  take 
  154.         the form shown in figure 6.2.
  155.  
  156.              Line 400 contains the REMark or comment.  Line 410 tests the 
  157.         state of the sensors.  If they are damaged, ie IF D(I) > 0 then a 
  158.         message  that  the  sensors  are damaged  is  displayed  and  the 
  159.         subroutine exits at this time, as since the sensors are  damaged, 
  160.         there is no point is continuing in the sequence.
  161.  
  162.              Line  420  checks  to see if the  quadrant  is  outside  the 
  163.         galaxy.  If it is, the program flow advances to line 440 skipping 
  164.         the  scanning  of the quadrant.  If this test  was  not  present, 
  165.         BASIC  would output an error message when it tries to update  the 
  166.         Q(I,J)  array for quadrants outside the galaxy.  The  reason  for 
  167.         the  error messages is that when Q1 or Q2 have  negative  values, 
  168.         the  statement  Q(Q1,Q2)  is invalid.  There  is  also  no  space 
  169.         allocated  in  the array for when Q1 and Q2 have  values  greater 
  170.         than  7.  to store any data.  The test used the OR  statement  to 
  171.         determine  if  any one of four conditions is met.  If  anyone  of 
  172.         them  is, the Enterprise is outside the Galaxy, because in  order 
  173.         to be in the galaxy, the Q1 and Q2 co-ordinates of the ship  must 
  174.         have values in the range of 0 to 7.
  175.  
  176.              The  state of the ship's computer (D(5)) is tested  in  line 
  177.         430.   If  it  is working, ie. IF D(5) = 0 then the  Map  can  be 
  178.         updated.   The  map  is  updated  by  the  statement  Q(Q1,Q2)  = 
  179.         ADS(Q(Q1,Q2)) which makes the contents of the quadrant a positive 
  180.         number.    This  is  the  normal  scanning  technique  as    used 
  181.         previously.   If  the computer was damaged, the contents  of  the 
  182.         quadrant  are not entered into the map, but the radar display  is 
  183.         still performed beginning at line 440.
  184.  
  185.              Line  440 first uses the subroutine starting at line  70  to 
  186.         display the heading.  It then determines the current condition of 
  187.         the Enterprise by calling the subroutine beginning at line  3400.  
  188.         It next displays the column number using the statement
  189.                            PRINT "  1 2 3 4 5 6 7 8";
  190.         which is a simple method of doing the job.  The Long Range Sensor 
  191.  
  192.  
  193.         Copyright (c) Joe Kasser 1989
  194.  
  195.  
  196.  
  197.  
  198.  
  199.         Chapter6 PAGE 4 STARTREK THE COMPUTER PROGRAM
  200.  
  201.  
  202.         display  used a different technique which was more complex.   Two 
  203.         different techniques for doing almost the same job have thus been 
  204.         presented for your review.  Which one is correct?  They are  both 
  205.         correct.  In your future programs use the one you like best.  The 
  206.         line is then tabbed across to the 20th character position by the 
  207.         TAB(20)  ; and the subroutine starting at line 170 is invoked  to 
  208.         display the current score.  The line then sets up the row loop.
  209.  
  210.              Line  450 contains the column loop.  It first  displays  the 
  211.         contents of each sector along the row and then tabs the cursor to 
  212.         the  20th character position along the display line.   Before  we 
  213.         look  at line 450, consider for a minute how the contents of  the 
  214.         sectors  are distinguished.  The contents of each sector  S(I,J), 
  215.         can be set up to be an integer between 1 and 5 where 
  216.  
  217.         1    represents a blank or empty sector
  218.         2    represents a star
  219.         3    represents the Enterprise
  220.         4    represents a Klingon (an enemy vessel)
  221.         5    represents a starbase.
  222.  
  223.              So  if for example, for any sector with co-ordinates  (I,J), 
  224.         if  S(I,J) = 4, there is a Klingon in that sector.  Each  of  the 
  225.         objects  that can be in a sector are represented by a  letter  as 
  226.         follows
  227.  
  228.          .    for a blank or empty sector
  229.          *    for a star
  230.          E    for the Enterprise
  231.          K    for a Klingon (an enemy vessel)
  232.          B    for a starbase.
  233.  
  234.              These  letters  are  stored  as a string  S$  in  the  order 
  235.         corresponding  to  the number associated with the  object.   This 
  236.         means that S$ = ".*EKB" because the correspondence is as follows.
  237.  
  238.         1     .    for a blank or empty sector
  239.         2     *    for a star
  240.         3     E    for the Enterprise
  241.         4     K    for a Klingon (an enemy vessel)
  242.         5     B    for a starbase.
  243.  
  244.              In  order to display the letter for the object, we  have  to 
  245.         pick  the correct letter out of S$.  For example, if S(I,J)  =  4 
  246.         the  fourth  letter  in S$ which happens to be a  "K"  is  to  be 
  247.         displayed,  because  the number 4 in S(I,J)  corresponds  to  the 
  248.         presence of a Klingon.
  249.  
  250.              Line  450  displays the corresponding letters by  using  the 
  251.         PRINT MID$(S$,N,L) function in the form PRINT  MID$(S$,S(I,J),Z); 
  252.         "  "; which operates as follows.  The Z at the end (the number  1 
  253.         corresponding to the 'L') tells the computer that a one character 
  254.         string  long  is to be displayed.  S$ tells  the  computer  which 
  255.         string  to search for the letter.  The starting location  of  the 
  256.         string  to be displayed is set by the contents of  S(I,J).   Thus 
  257.  
  258.  
  259.         Copyright (c) Joe Kasser 1989
  260.  
  261.  
  262.  
  263.  
  264.  
  265.         Chapter6 PAGE 5 STARTREK THE COMPUTER PROGRAM
  266.  
  267.  
  268.         for  each  sector  in  the  quadrant,  the  value  of  S(I,J)  is 
  269.         determined.  The letter corresponding to the number stored in the 
  270.         S(I,J)  array is then displayed followed by a "space"  character.  
  271.         The  J  loop repeats until the contents of all the sectors  in  a 
  272.         particular  row have been displayed. At the end of the  row,  the 
  273.         cursor  is moved to the position of the 20th character along  the 
  274.         line by the PRINT TAB(20) ;  statement.  Note the use of the semi 
  275.         colon  after both the MID$ and TAB print statements to  stop  the 
  276.         cursor advancing to the next line.
  277.  
  278.              If  you look back to the example of the Short  Range  Sensor 
  279.         display, you will see that a different item of status information 
  280.         is  displayed  at  the end of each line.   Line  460  routes  the 
  281.         computer  to the correct item to be displayed by the use  of  the 
  282.         'ON'  statement.   Lines 500 to 570 inclusive  display  the  data 
  283.         elements.   Since  the  value of the  line  counter  (I),  varies 
  284.         between 0 and 7, while the 'ON' statement requires a number equal 
  285.         to 1 or more, I+Z is used to convert the line count of 0-7 to the 
  286.         range of 1-8 needed for the ON statement.
  287.  
  288.              When  the  'ON' statement is encountered  the  program  flow 
  289.         branches  to the destination specified by the order of  the  line 
  290.         numbers.  In our case after the first row is displayed, when  I+Z 
  291.         = 1, the program will branch to line 470.  After the second  row, 
  292.         to line 480, after the third row to line 490, and so on.
  293.  
  294.              Each  of  these lines are similar.  They first  display  the 
  295.         name  of the data element.  The cursor position is then moved  to 
  296.         the  38th  character position along the line  by  the  'TAB(38);' 
  297.         statement and the contents of the actual element then  displayed.  
  298.         After  each element has been displayed the program flow  branches 
  299.         forward  to line 550 which increments the row loop  counter,  and 
  300.         when it times out, terminates the command function (subroutine).
  301.  
  302.              The variables used to store the game status items are as follows.
  303.  
  304.         T    =    The DAYS LEFT in the game
  305.         C$   =    The CONDITION of the Enterprise
  306.         E1   =    Energy in the SHIELDS
  307.         E    =    The total ENERGY of the Enterprise
  308.         P    =    The number of PHOTON TORPEDOES left
  309.         B9   =    The number of STARBASES remaining (multiplied by 10)
  310.         K9   =    The number of KLINGONS LEFT in the galaxy (multiplied by 10)
  311.         K4   =    The number of KLINGONS CAPTURED"
  312.  
  313.              Since both B9 and K9 are stored multiplied by 100, they have 
  314.         to  be divided by 100 before being displayed, hence for  example, 
  315.         the K9/100 in the PRINT statement of line 530.
  316.  
  317.              The subroutine to calculate and display the score begins  at 
  318.         line 170 with the usual REMark statement.  The score changes as a 
  319.         function  of the time elapsed since the game started, the  number 
  320.         of  Klingons  destroyed and the number of  Klingons  captured  or 
  321.         suicided.  Line 180 computes a value for the score and places  it 
  322.         in the temporary variable 'N' using the statement
  323.  
  324.  
  325.         Copyright (c) Joe Kasser 1989
  326.  
  327.  
  328.  
  329.  
  330.  
  331.         Chapter6 PAGE 6 STARTREK THE COMPUTER PROGRAM
  332.  
  333.  
  334.         180 N=INT(((K8-K9)/100)*(K5/2.5+K4+Z)^2*100/(T9-T)) : IF N<0 THEN N=0
  335.  
  336.         Consider  the  statement  in sections.  The  number  of  Klingons 
  337.         destroyed is computed using the 
  338.                                 INT((K8-K9)/100) 
  339.         statement.   The  result  is then divided  by  the  elapsed  time 
  340.         calculated in the 
  341.                                      (T9-T) 
  342.         statement.   If  the score was just a function of the  number  of 
  343.         enemy ships destroyed in the elapsed time so far, the value of  N 
  344.         would be
  345.                         180 N=INT(((K8-K9)/100)/(T9-T)).  
  346.         However a multiplier is put  in 
  347.         to  make capturing Klingons worth while even though they tend  to 
  348.         damage  the  Enterprise  during  the  capturing  process.    This 
  349.         multiplication factor is given by the statement
  350.                                (K5/2.5+K4+Z)^2*100
  351.         which  represents  one hundred time the square of the  number  of 
  352.         Klingons captured (K4) added to the number of Klingons that  have 
  353.         suicided (K5) divided by two and a half.  This complex multiplier 
  354.         generously  rewards the player for taking the time and effort  to 
  355.         capture  Klingons and also gives a small amount  of  compensation 
  356.         for those that were destroyed by their own captain rather than be 
  357.         captured.  If the value computed for N by the expression
  358.                  N=INT(((K8-K9)/100)*(K5/2.5+K4+Z)^2*100/(T9-T)) 
  359.         is  negative, the value of N is set to zero by the statement 
  360.                                  IF N<0 THEN N=0 
  361.          at the end of the line.
  362.  
  363.              Line  190 displays the score in a formatted position in  the 
  364.         display  using  the  'PRINT  "SCORE";TAB(38);N'  statements   and 
  365.         terminates the subroutine with the 'RETURN' statement at the  end 
  366.         of the line.
  367.  
  368.              At this carefully time copy lines 400 to 550 and line 170 to 
  369.         190 from figure 6.2 into your program and save it.  Do not try to 
  370.         execute the Short Range Sensor command at this time.  If you  do, 
  371.         you  will get error messages, because certain prerequisites  have 
  372.         not been met.
  373.  
  374.         6.2 The VISUAL Command
  375.  
  376.              Now  would  be a good time to look at  the  VISual  command, 
  377.         since it essentially performs a subset of the Short Range  Sensor 
  378.         command.    The  Visual  command displays  the  contents  of  the 
  379.         sectors  adjacent to the Enterprise.  If the co-ordinates of  the 
  380.         Enterprise in the Quadrant are S1 and S2 (ie S(S1,S2) =  3), then 
  381.         to display the contents of the adjacent sectors to the Enterprise 
  382.         the  row and column loop counters just have to work on S1 and  S2 
  383.         plus or minus 1.  
  384.  
  385.              The  visual  command is normally only used  when  the  Short 
  386.         Range Sensors are damaged.  
  387.  
  388.              Samples of the VISUAL command display are
  389.  
  390.  
  391.         Copyright (c) Joe Kasser 1989
  392.  
  393.  
  394.  
  395.  
  396.  
  397.         Chapter6 PAGE 7 STARTREK THE COMPUTER PROGRAM
  398.  
  399.  
  400.  
  401.         (a)  . . . . .     (b)  . . . . .     (c)  $ $ . . .
  402.              . . . . .          . . . . .          $ $ * * .
  403.              . . E K .          . B E K .          $ $ E . .
  404.              $ $ $ $ $          . . . . .          $ $ . . .
  405.              $ $ $ $ $          . . . . .          $ $ . . .
  406.  
  407.         the  first  one  (a) shows the Enterprise and a  Klingon  on  the 
  408.         bottom row of the quadrant.  The second (b) shows the Enterprise, 
  409.         a  starbase and a Klingon somewhere in the middle sectors of  the 
  410.         quadrant, and the last one (c) places the Enterprise in the first 
  411.         column of sectors.  Two stars are also shown in the row above the 
  412.         Enterprise.
  413.  
  414.              The  flow  chart for the VISUAL command is shown  in  figure 
  415.         6.3.
  416.  
  417.              The  Visual command always works because you can always  see 
  418.         out of the windows.  The command is thus two loops for displaying 
  419.         the  contents of the sectors adjacent to the  Enterprise.    Care 
  420.         must  be taken so that sectors that are outside the quadrant  are 
  421.         treated  differently  to sectors inside the  quadrant.   This  is 
  422.         because  the computer will output an error message if an  attempt 
  423.         to  access an illegal value of S(I,J) is made.  and of  course  I 
  424.         and  J will have illegal values for sectors outside the  quadrant 
  425.         (ie less than 0 or greater than 7).  These sectors are  displayed 
  426.         as  dollar  signs to enable the player to locate  the  Enterprise 
  427.         within a quadrant should the Short Range Sensors be damaged.
  428.  
  429.              The  Visual  Command subroutine may be written in  BASIC  as 
  430.         shown in figure 6.4.
  431.  
  432.              It begins at line 2500 with the usual REMark statement.  The 
  433.         heading  is  displayed  when line  2510  invokes  the  subroutine 
  434.         starting at line 70.  Two loops are invoked using a FOR/NEXT loop 
  435.         format as
  436.                   FOR I = S1-2 TO S1+2 : FOR J = S2-2 TO S2+2. 
  437.  
  438.              Line  2520  tests to see if the sector  whose  contents  are 
  439.         being displayed are inside the quadrant by using the logical 'OR' 
  440.         statement.  The statement 
  441.                         IF I<0 OR I>7 OR J<0 OR J>7 THEN 
  442.         will only be true if any one of the four conditions being  tested 
  443.         are  met.   That is, if the value of I or J are less  than  0  or 
  444.         greater than 7.  If they are the 'PRINT "$"; : GOTO 2540' part of 
  445.         the  line displays the dollar sign and advances the program  past 
  446.         line 2530 which does the displaying of the letter associated with 
  447.         the  contents  of  a sector as discussed above by  means  of  the 
  448.         'PRINT  MID$(S$,S(I,J),Z);'  statement.  Line 2540  displays  the 
  449.         "space" character then advances the column counter.  After a  row 
  450.         has  been displayed, a 'PRINT' statement moves the cursor to  the 
  451.         next line and the row counter is incremented.  When that loop  is 
  452.         terminated,  the  'last command flag' (C9) is set to  one  to  to 
  453.         inhibit  line  3090 (in the main command loop)  from  moving  any 
  454.         Klingons  in  the  quadrant.  The subroutine  terminates  at  the 
  455.  
  456.  
  457.         Copyright (c) Joe Kasser 1989
  458.  
  459.  
  460.  
  461.  
  462.  
  463.         Chapter6 PAGE 8 STARTREK THE COMPUTER PROGRAM
  464.  
  465.  
  466.         RETURN statement.
  467.  
  468.              At  this time carefully copy lines 2500 to 2540 from  figure 
  469.         6.4  into your computer program, don't forget to update the  date 
  470.         in  line  10,  and save them.  Again do not try  to  execute  the 
  471.         command  at  this  time or you will get  error  messages  because 
  472.         before the contents of a quadrant can be displayed visually or as 
  473.         a  short range radar display, they have to be set up first.   The 
  474.         contents  of  the  Q(I,J) array  corresponding  to  a  particular 
  475.         quadrant  have to be transformed into values that can be used  to 
  476.         position  the different objects into various  sectors.   Consider 
  477.         the sample short range radar display shown above.
  478.  
  479.              There  are two Klingons, no starbases and six stars  in  the 
  480.         Quadrant.    The  Quadrant co-ordinates are 4,6 so we  know  that 
  481.         Q(4,6)  = 206.   Thus before a Short Range Sensor command can  be 
  482.         performed,  that 206 has to be transformed so that the  Klingons, 
  483.         stars and the Enterprise can be positioned in the various sectors 
  484.         within the quadrant.   
  485.  
  486.              The  flow  chart to set up a new quadrant and  position  the 
  487.         objects  within it is shown in figure 6.5.  The first thing  that 
  488.         is  done  is to clean up the quadrant by making all  the  sectors 
  489.         blank.   This  takes care of any previous contents of  the  array 
  490.         associated   with   any  previous  quadrant.    The   number   of 
  491.         Klingons,starbases  and stars in the quadrant are then  computed.  
  492.         The Enterprise is then positioned in the quadrant followed by the 
  493.         Starbase  if any, the stars and then the Klingons, again if  any.  
  494.         If  there are enemy ships in the quadrant, a 'RED ALERT'  message 
  495.         is  displayed.  The program then checks to see if the player  has 
  496.         put  the shield up.  If they are down, a message is displayed  to 
  497.         that  effect.  The message is put out by the  "Starfleet  Command 
  498.         Training Simulator" part of the program.
  499.  
  500.              The BASIC language implementation of the flowchart could  be 
  501.         as  shown  in  figure  6.6.  It begins  at  line  3200  with  the 
  502.         customary REMark statement.  Line 3210 then sets every sector  in 
  503.         the  quadrant to blank (ie it sets S(I,J) = 1).  The  real  thing 
  504.         then begins at line 3220.
  505.  
  506.              Line 3220 tests for,and sets up the contents of, a  quadrant 
  507.         that  is  outside  the  galaxy.   By  definition,  there  are  no 
  508.         starbases or klingons outside the galaxy.  There is also a remote 
  509.         possibility  of the presence of a rogue star outside the  galaxy.  
  510.         The test to see if the quadrant is inside the galaxy begins  with 
  511.         the  now  familiar 'OR' test on the four requirements  for  being 
  512.         within the galaxy
  513.                       IF Q1<0 OR Q1>7 OR Q2<0 OR Q2>7 THEN 
  514.         if the test is true the program continues along the line.  If the 
  515.         test is false, and the Enterprise is somewhere inside the galaxy, 
  516.         the  program  continues with the next line (line 3230).   If  the 
  517.         Enterprise  is  outside  the galaxy,  the  Starbase  and  Klingon 
  518.         variables are set to zero by the statements
  519.                                   K=0 :  B=0 :.
  520.  
  521.  
  522.  
  523.         Copyright (c) Joe Kasser 1989
  524.  
  525.  
  526.  
  527.  
  528.  
  529.         Chapter6 PAGE 9 STARTREK THE COMPUTER PROGRAM
  530.  
  531.  
  532.              A  random  number between 0 and 1.199 is then  computed  and 
  533.         converted to an integer by the statement
  534.                                S=INT(RND(Z)*1.2).  
  535.         The  probability of S being equal to one is thus quite low.   The 
  536.         line terminates with the 'GOTO 3250' statement which bypasses the 
  537.         regular setting up code.
  538.  
  539.              Line  3230  uses N as a temporary variable.  N is given  the 
  540.         absolute  value  of the contents of the quadrant using the  'N  = 
  541.         ABS(Q(Q1,Q2))' statement.  Since the number of Klingons is  equal 
  542.         to  the hundreds digit, N can be divided by 100 to find  out  how 
  543.         many  Klingons  are  in the Quadrant.  Suppose  for  example  the 
  544.         quadrant  Q(Q1,Q2) = 306, there will be 3 Klingons, no  starbases 
  545.         and  6 stars in the quadrant.  N is thus 306. If N is divided  by 
  546.         100  it will have a value of 3.06.   It is then converted  to  an 
  547.         integer  (no  decimal  point) by using the  INTeger  function  in 
  548.         BASIC.   The statement thus used to find the value of the  number 
  549.         of  Klingons in the quadrant (represented by the variable K)  is, 
  550.                                 'K = INT(N/100)'.
  551.  
  552.              N is again used as a temporary variable in the detection  of 
  553.         the presence of a starbase.  The original value of N is the total 
  554.         contents  of the quadrant.  K is the number of Klingons.  If  the 
  555.         number of Klingons in the quadrant is multiplied by 100 and  then 
  556.         subtracted from the original number, all that will be left is the 
  557.         number of stars and starbases.  In our example we would see  306-
  558.         300 or 6.  This function is performed in BASIC by the identity 
  559.                                 'N = N - K*100'.
  560.  
  561.              The  presence of a starbase can be detected in a  number  of 
  562.         ways.   The  technique  used  here is similar  to  that  used  to 
  563.         determine  the number of Klingons, namely 'B = INT(N/10)'.   This 
  564.         sets the value of 'B' to either '1' or '0' depending if a base is 
  565.         there  or is not.  An alternative method could be to test to  see 
  566.         if N is greater than 10 and if so, set the value of B to 1,  else 
  567.         make it a 0.  That could be written in BASIC as
  568.                         IF N > 10 THEN B = Z ELSE B = 0.
  569.         an  approach  that  would  lock the game  into  only  having  one 
  570.         starbase  per quadrant.  The technique used in line 3230 is  more 
  571.         general and does not care how many bases are in the quadrant.
  572.  
  573.              Line  3240 computes the number of stars in the  quadrant  by 
  574.         subtracting  the number of Klingons (multiplied by 100)  and  the 
  575.         number of starbases (multiplied by 10) from the original contents 
  576.         of the quadrant using the statement
  577.                          S = ABS(Q(Q1,Q2))-(K*100+B*10).
  578.         It  has to use the 'ABS(Q(Q1,Q2))' value because the value  of  N 
  579.         was  changed  by the operation that just preceded it  and  is  no 
  580.         longer equal to the contents of the quadrant.
  581.  
  582.              Line 3250 invokes the subroutine beginning at line 50 to get 
  583.         two  random numbers.  The co-ordinates of the  Enterprise  within 
  584.         the quadrant (S1 and S2) are then set up.  S1 is the row position 
  585.         and S2 the column position.  The subroutine used X and Y as dummy 
  586.         variables  for  the  purpose of communicating  with  the  calling 
  587.  
  588.  
  589.         Copyright (c) Joe Kasser 1989
  590.  
  591.  
  592.  
  593.  
  594.  
  595.         Chapter6 PAGE 10 STARTREK THE COMPUTER PROGRAM
  596.  
  597.  
  598.         routine  (the two numbers have to be passed somehow).   We  could 
  599.         have defined two special variable R1 and R2 for example, for this 
  600.         purpose,  but  did not.  X and Y can be reused elsewhere  in  the 
  601.         program  whenever  a  temporary variable  is  required.   Reusing 
  602.         variables  is  a good idea in that it saves  memory  (since  each 
  603.         variable occupies memory, and the more there are, the more memory 
  604.         is used).  It is not a good idea in the sense that if you are not 
  605.         careful which and where variables are reused, strange things will 
  606.         happen when you un-intentionally re-use a variable.  The contents 
  607.         of  the quadrant occupied by the Enterprise are set to 3  by  the 
  608.         'S(X,Y) = 3' part of the line.
  609.  
  610.              The  last  part of the line tests to see if  a  starbase  is 
  611.         present  in  the  quadrant.  if B = 0 then one  is  not  and  the 
  612.         program flow skips to line 3270.  If one is, line 3260  positions 
  613.         it  as  follows.   The random number  generator  subroutine  that 
  614.         starts  at line 50 is called.  It returns two numbers (X  and  Y) 
  615.         which are now assumed to be the co-ordinates of the quadrant that 
  616.         the  base is to be located in.  If the contents of  the  quadrant 
  617.         are  not equal to 1, ie the quadrant is not blank, a  new  random 
  618.         quadrant is chosen.  If the quadrant is blank, it is set to 5, to 
  619.         signify   the   presence  of  the  base.   The   BASIC   language 
  620.         implementation of the operation is
  621.                     IF S(X,Y) <> Z THEN 32650 ELSE S(X,Y) = 5
  622.         where  <> means "is not equal to".  Literally is means, "is  less 
  623.         than, or, is greater than".  If a number is less than or  greater 
  624.         than another number, they certainly cannot be equal.
  625.  
  626.              For  each star in the quadrant, the FOR/NEXT loop  in  lines 
  627.         3270 and 3280 locate a blank sector and position a star in it  in 
  628.         a similar manner.
  629.  
  630.              The  last  part  of  line 3290  tests  for  the  absence  of 
  631.         Klingons.  If the value of K = 0 then no Klingons are present  in 
  632.         the quadrant and the program flow branches forward to line  3340.  
  633.         If  there are Klingons in the quadrant, they are positioned in  a 
  634.         likewise manner by the FOR/NEXT loop in lines 3300 to 3320.  Line 
  635.         3300  sets up the individual Klingon data.  The row  (K1(I))  and 
  636.         column (K2(I)) co-ordinates are first set up, and then the energy 
  637.         available  to the Klingon is then calculated.  All  Klingons  are 
  638.         given   a random amount of energy between 0 and 999  units.   The 
  639.         amount of energy is stored in the K3(I) array.  The last part  of 
  640.         the line displays a "RED ALERT" message using a FOR/NEXT loop  to 
  641.         display the words "RED ALERT" three times using the statements
  642.                  'FOR I = 0 TO 3 : PRINT "RED ALERT    " : NEXT'
  643.         The  task could have been written using a different statement  as 
  644.         shown below
  645.                   PRINT "RED ALERT    RED ALERT    RED ALERT".
  646.         You  will  find  many  places where  a  particular  task  can  be 
  647.         implemented in a number of ways, most of them equally correct.
  648.  
  649.              Line  3330  outputs a "beep" or tome to the  terminal.   The 
  650.         standard ASCII control character used to sound a bell tone at the 
  651.         console terminal is 7.  The character is a non printing one.  The 
  652.         'CHR$(7)' function tells BASIC to output the control character  7 
  653.  
  654.  
  655.         Copyright (c) Joe Kasser 1989
  656.  
  657.  
  658.  
  659.  
  660.  
  661.         Chapter6 PAGE 11 STARTREK THE COMPUTER PROGRAM
  662.  
  663.  
  664.         to  the terminal.  If you remember, CHR$(26) was used earlier  to 
  665.         clear  the screen.  The last part of the line samples the  amount 
  666.         of energy in the Shields. if it is zero, the shields are down and 
  667.         the  player has moved the Enterprise into a  quadrant  containing 
  668.         enemy  vessels.   That is a definite NO-NO!  A  message  to  that 
  669.         effect  is  displayed.  There is also a good probability  as  you 
  670.         will  find  later, that the Enterprise will be destroyed  by  the 
  671.         Klingons.
  672.  
  673.               Copy lines 3200 to 3340 from figure 6.6 into your  computer 
  674.         program  at this time and save it.  Then try to RUN the  program.  
  675.         The  Visual and Short Range Sensor displays should work and  show 
  676.         active displays.   The CONDITION will be blank because C$ has not 
  677.         yet been set up.  If your program is not performing correctly and 
  678.         you  are getting error messages, debug it and eliminate  them  at 
  679.         this  time,  then save the corrected or debugged version  of  the 
  680.         program.   Add  a  temporary line or statement  to  define  C$  = 
  681.         "DEBUG"  in  case  the  absence of a  defined  value  for  C$  is 
  682.         bothering your computer.
  683.  
  684.               A  static  display like this is dull so lets fudge  a  move 
  685.         command  to position the Enterprise in different quadrants.   For 
  686.         debugging, we can put in a temporary move command as shown  below 
  687.         which will allow different quadrants to be scanned.
  688.  
  689.         1300 REM NAV WARP ENGINES/NAVIGATION
  690.         1310
  691.         1305 GOSUB 50 : Q1 = X : Q2 = Y : GOSUB 3200 
  692.         1315 PRINT "MOVED TO QUADRANT ";Q1+Z;",";Q2+Z
  693.         1750 RETURN
  694.  
  695.              These lines perform a "move" operation on the Enterprise  by 
  696.         relocating it at random throughout the galaxy each time the  Move 
  697.         command  is  invoked.   Note  the use  of  numbers  ending  in  5 
  698.         signifying by our convention that they are temporary lines to  be 
  699.         deleted  later.   These lines are inserted following  line  1300.  
  700.         Line 1310 is left blank.  Just enter the line number followed  by 
  701.         a  carriage return.  This procedure will delete the current  line 
  702.         1310 which contains a 'GOTO 1000' instruction.
  703.  
  704.              Line  1605 uses the random number subroutine to set  up  the 
  705.         Galactic Quadrant co-ordinates (Q1 and Q2) of the Enterprise. The 
  706.         set  up subroutine of line 3200 is then invoked to  position  the 
  707.         contents of the quadrant in the relevant sectors.  The  variables 
  708.         Q1  and Q2 are used to remember in which quadrant the  Enterprise 
  709.         is  located at any stage of the game, in a similar manner to  the 
  710.         use  of  S1  and S2 to note which sector inside  a  quadrant  the 
  711.         Enterprise is occupying.  Q1 and Q2 are important when moving the 
  712.         Enterprise  around  the galaxy and S1 and S2 are  important  when 
  713.         things will begin to happen inside the quadrant.
  714.  
  715.              Line  1615 displays a message that the Enterprise has  moved 
  716.         and also displays the destination.  The +Z in the PRINT statement 
  717.         is  used to convert the 0-7 co-ordinates that the  computer  uses 
  718.         tot  he 1-8 that the player uses.  The point has  been  discussed 
  719.  
  720.  
  721.         Copyright (c) Joe Kasser 1989
  722.  
  723.  
  724.  
  725.  
  726.  
  727.         Chapter6 PAGE 12 STARTREK THE COMPUTER PROGRAM
  728.  
  729.  
  730.         earlier.  The subroutine terminates at line 1625.
  731.  
  732.              Enter  lines 1605 to 1625 and run the program.   You  should 
  733.         now  be  able to move the Enterprise around the  galaxy  and  get 
  734.         different displays when executing the Short Range Sensor, Visual, 
  735.         Map  and  Long  Range Sensor commands  while  moving  around  the 
  736.         different quadrants in the galaxy.
  737.  
  738.              Stop  the program execution (^C) and enter D(5) =  2.   Then 
  739.         let the program CONTinue. You will now find that the Map does not 
  740.         work.   The  computer is down.  Move to a new quadrant and  to  a 
  741.         Long  Range Sensor Scan.  Then use the Damage Control  to  repair 
  742.         the  computer  and try the Map display again.  If  all  has  gone 
  743.         well, you will find that the information about the quadrant  that 
  744.         the Enterprise is currently located in has not been entered  into 
  745.         the Map.  If it has, you either have a bug in your version of the 
  746.         Program, or the data was entered by a previous Long Range  Sensor 
  747.         scan.   Stop  the program, enter D(5) = 2 and  move  again.   Now 
  748.         exercise the Map, repair the computer and try the map again.  The 
  749.         map  should not show the contents of the  Enterprise's  quadrant.  
  750.         Do  a  Long Range Sensor scan and then a Map  command.   The  map 
  751.         should now be updated.
  752.  
  753.              At this time, a lot has been accomplished.  All that is left 
  754.         as  far as the quadrant is concerned is to set up  the  Condition 
  755.         (C$),  ie  determine  the  Condition of  the  starship.   If  you 
  756.         remember the condition was defined as follows.
  757.              
  758.         RED        Battle area, enemy in quadrant
  759.         YELLOW     One  of  the  sub-systems  aboard  the  Enterprise  is 
  760.                    damaged,  or the Energy level has fallen to below  400 
  761.                    units.
  762.         GREEN      Everything  is  fine, no enemy detected,  damage,  and 
  763.                    sufficient energy aboard the ship.
  764.  
  765.              The flow chart to determine the condition of the  Enterprise 
  766.         is shown in figure 6.7.
  767.  
  768.              The  first  thing that happens is that the contents  of  the 
  769.         sectors  adjacent  to the Enterprise are sampled to  see  if  the 
  770.         Enterprise  is located next to a starbase.  If the Enterprise  is 
  771.         located  in a sector adjacent to a base, then a further  test  is 
  772.         performed  to  see if the Enterprise is already docked.   If  the 
  773.         Enterprise  is already docked, the parameters (Energy and  Photon 
  774.         Torpedoes)  are reset to their initial values.  This  allows  the 
  775.         player to blast away at any Klingons in the sector while the Base 
  776.         continually resupplies the ship.
  777.  
  778.              If  the  Enterprise  is  not yet  docked,  then  a  test  is 
  779.         performed  to determine if any Klingons are in the quadrant.   If 
  780.         there  are, there is a possibility that the starbase will not  be 
  781.         able to lower its shields (presumably it is also under attack  by 
  782.         the enemy) to allow the Enterprise to dock.  This possibility  is 
  783.         set at 50%.  Thus if there are Klingons in the quadrant, there is 
  784.         a  50% probability that the Enterprise will not be able to  dock.  
  785.  
  786.  
  787.         Copyright (c) Joe Kasser 1989
  788.  
  789.  
  790.  
  791.  
  792.  
  793.         Chapter6 PAGE 13 STARTREK THE COMPUTER PROGRAM
  794.  
  795.  
  796.         Its  too  bad if you are badly hit and are limping home  to  base 
  797.         with  the Klingons firing at you. If you are really unlucky  they 
  798.         might  even destroy the Enterprise while it is waiting  to  dock.  
  799.         The docking procedure, displays a message that docking is  taking 
  800.         place, deducts half a stardate from the time left in the game and 
  801.         updates  the ship's Energy and weapon parameters.  The  condition 
  802.         of the ship is also set to "DOCKED" at this time.
  803.  
  804.              On  the  other hand, if the Enterprise is not located  in  a 
  805.         quadrant  that is adjacent to a base, the program first tests  to 
  806.         see  if any Klingons are present in the quadrant.  If  they  are, 
  807.         the  condition is set to "RED".  If no Klingons are  there,  then 
  808.         the condition can be either "YELLOW" or "GREEN".
  809.  
  810.              The  condition can be "YELLOW" if one of the  subsystems  is 
  811.         damaged,  or if the total remaining energy aboard the  Enterprise 
  812.         is less than 400 units (10% of the initial value).  If either  of 
  813.         those  conditions  are met, the condition is set to  YELLOW.   If 
  814.         none are met, all is assumed to be OK and the condition is set to 
  815.         "GREEN".
  816.  
  817.              The  BASIC  language implementation of the flowchart  is  as 
  818.         shown in figure 6.8.  The subroutine begins at line 3400 with the 
  819.         usual  REMark.   Line 3410 commences two loops that  perform  the 
  820.         sector scan.  The technique used is almost the  same as that used 
  821.         in the Visual command.  Here instead of accepting what ever is in 
  822.         the sector, we just need to know if one contains a base.  The row 
  823.         and column loops scan one sector in each side of the  Enterprise, 
  824.         including  the  one occupied by the Enterprise itself.   We  know 
  825.         that  that  test will fail, but so what?  The search  routine  is 
  826.         simplified if we can treat all sectors in the same way.  We  thus 
  827.         just performs a continuous scan on nine sectors (three per row).
  828.  
  829.              Line 3420 checks to see if a sector is outside the quadrant.  
  830.         If  it is the program skips forward to line 3440  bypassing  line 
  831.         3430 which  does the actual test to see if the sector contains  a 
  832.         Starbase using the statement 
  833.                            IF  S(I,J)  =  5 THEN 3450.
  834.         If the sector does contain a base, the loop is terminated by  the 
  835.         branch to line 3450.  The test is skipped for sectors outside the 
  836.         galaxy  because  S(I,J) is invalid if I or J are less than  0  or 
  837.         greater than 7.  Line 3440 terminates the loops and then  directs 
  838.         the program to continue at line 3490 in the event that a Starbase 
  839.         was not found.
  840.  
  841.              If  a  base was located, the program picks up at  line  3450 
  842.         which  tests  to see if the Enterprise is  already  docked.   The 
  843.         value  of  C$ is used as the condition flag.  If it  is  "DOCKED" 
  844.         then  the  Enterprise is already docked and  the  parameters  are 
  845.         updated using the subroutine starting at line 90 and repairs  all 
  846.         the  subsystems by calling the subroutine starting at  line  3550 
  847.         which  sets all sub-systems to "working" (D(I)=0).   The  routine 
  848.         then branches forward to line 3540.
  849.  
  850.              It is simpler to just set all the sub-systems to zero rather 
  851.  
  852.  
  853.         Copyright (c) Joe Kasser 1989
  854.  
  855.  
  856.  
  857.  
  858.  
  859.         Chapter6 PAGE 14 STARTREK THE COMPUTER PROGRAM
  860.  
  861.  
  862.         than  test  each one and set it to zero if it is non  zero.   The 
  863.         computer is fast, the player will never notice the difference  in 
  864.         execution  time between the two different methods.  Setting  them 
  865.         all to zero irrespective of the way way they were results in them 
  866.         all  being zero, and that is what we want.  Programs  should  use 
  867.         the  "KISS" principle as well as being structured.  KISS  by  the 
  868.         way is an acronym for 
  869.                              KEEP IT SIMPLE STUPID.
  870.  
  871.              If  the Enterprise is not docked, line 3460 tests to see  if 
  872.         there  are  any  Klingons in the Quadrant.   The  test  statement 
  873.         includes the logical 'AND' statement.   This means that both test 
  874.         conditions  have to true before the program will continue at  the 
  875.         line number specified by the 'THEN' part of the test. 
  876.  
  877.              The  first  part of the test (IF K>0 ) tests to see  if  the 
  878.         number of Klingons in the sector is greater than zero.  If it is, 
  879.         then  there  are enemy vessels in the quadrant.   At  this  time, 
  880.         their numbers do not matter. The second part of the test  (RND(Z) 
  881.         <  .5  )  uses the random number function  built  into  BASIC  to 
  882.         generate  a  random number between 0 and 0.99999.  The number  is 
  883.         then  compared  with a constant (0.5).  If the random  number  is 
  884.         less  than  0.5  (a 50% probability), the test is  true  and  the 
  885.         program flow continues at line 3490.  Note that if the first test 
  886.         fails,  Microsoft BASIC will ignore the second test and  continue 
  887.         program execution at the next line number.
  888.  
  889.              The docking procedure begins at line 3470.  The first  thing 
  890.         that  happens, is that a message is displayed telling the  player 
  891.         that  the  Enterprise is docking. The display message is  in  two 
  892.         parts.  D$(6) is used to save space in the program  source  code.  
  893.         We  have previously defined D$(6) to contain the word "SHIELDS  " 
  894.         (see  line 4580).  Then the subroutine starting at line  3550  is 
  895.         invoked  to  repair all of the on-board sub-systems.    Once  the 
  896.         systems  are repaired, a message to that effect is  displayed  at 
  897.         the console by the last part of the line.  Line 3480 invokes  the 
  898.         parameter updating subroutine starting at line 90, then subtracts 
  899.         half  a stardate from the game time remaining ( T = T - .5 )  and 
  900.         sets the value of C$ to "DOCKED".  The program flow then branches 
  901.         forward to line 3540.
  902.  
  903.              Line  3490  is  where we pick up if the  Enterprise  is  not 
  904.         located  adjacent  to  a starbase.  It tests the value  of  K  to 
  905.         determine  if any of the enemy are present in the  quadrant.   If 
  906.         the value of K is greater than zero, namely there is at least one 
  907.         Klingon in the quadrant, then C$ is set to "RED" and the  program 
  908.         skips  to  line  3540.   If there  aren't  any  Klingons  in  the 
  909.         quadrant, then the program continues at line 3500.
  910.  
  911.              Line  3500  examines the state of the  sub-systems  using  a 
  912.         FOR/NEXT  loop.   If any sub-system has a value of  D(I)  greater 
  913.         than  0, it is damaged.  The contents of C$ are set  to  "YELLOW" 
  914.         and  the program flow leaves the loop by GOing TO line 3540.   We 
  915.         don't care which one is damaged, we only care if any one of  them 
  916.         is.   If the test fails, then all the subsystems are  in  working 
  917.  
  918.  
  919.         Copyright (c) Joe Kasser 1989
  920.  
  921.  
  922.  
  923.  
  924.  
  925.         Chapter6 PAGE 15 STARTREK THE COMPUTER PROGRAM
  926.  
  927.  
  928.         order,  and the loop times out naturally. The program then  tests 
  929.         the amount of Energy remaining aboard the starship  to see if  it 
  930.         is less than 10% of the initial value.  If it is, the contents of 
  931.         C$ are also set to "YELLOW"  else the amount of energy is greater 
  932.         than  10% of the initial value, (and nothing is damaged) and  the 
  933.         contents of C$ are set to "GREEN".   The subroutine terminates at 
  934.         line 3440.
  935.  
  936.              This  subroutine has itself called two subroutines,  one  at 
  937.         line  90, the second at line 3550.  When one subroutine calls  an 
  938.         other the second subroutine is called a "nested" subroutine.  The 
  939.         terminology is the same as that used to refer to loops.
  940.  
  941.              Copy  lines 3400 to 3540 from figure 6.8 into your  program, 
  942.         check  your spelling, then SAVE it and RUN it.   The game  should 
  943.         behave as before, but now, the condition should show up as  "RED" 
  944.         or  "GREEN" depending on the presence or absence of  Klingons  in 
  945.         the quadrant.  Break the program and set the amount of energy  to 
  946.         less  than 400 units (enter E = 200 for example).   CONTinue  the 
  947.         program and see if the condition changes between YELLOW and  RED.  
  948.         Stop the program (^C again), re RUN it and this time break it and 
  949.         damage a subsystem (enter D(I) = 3, where I is the number of your 
  950.         choice).  Now again test that the condition varies between YELLOW 
  951.         and  RED.   Repair  the damaged sub-system and  verify  that  the 
  952.         condition  now changes between GREEN and RED.  At this time  save 
  953.         the  program because it should be working properly.  Delete  line 
  954.         1305  and  1315 so as to avoid any trouble when  the  real  "MOV" 
  955.         command is implemented.
  956.  
  957.              At  this time the program should be as shown in figure  6.9.  
  958.         Once  the Short Range Sensors and the Visual commands  have  been 
  959.         programmed, the next stage is to implement the real move command.
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.         Copyright (c) Joe Kasser 1989
  986.  
  987.  
  988.  
  989.  
  990.  
  991.